<template>
    <div class="Child">
        <p>我是Child组件(子),{{car.name}}-{{car.price}}</p>
        <Son></Son>
    </div>
</template>

<script>
import { inject } from 'vue'
import Son from './Son.vue'
export default {
    name: 'Child',
    components: {Son},
    setup(){
        let car = inject('car')
        return{car}
    }
}
</script>

<style>
.Child{
    background: skyblue;
    padding: 10px;
}
</style>